package org.tang.stock;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;

public class TestSlope {
	public static void main(String[] args)  throws Exception {
	
		FileReader syzg = new FileReader(new File("D:\\table.csv"));
		BufferedReader buffer = new BufferedReader(syzg);
		ArrayList<Stock> stocks = new ArrayList<Stock>();
		String line = null;
		line = buffer.readLine();
		while ((line = buffer.readLine()) != null) {
			Stock tmp = new Stock(line);
			if (tmp.getVolume() != 0)
				stocks.add(tmp);
		}
		System.out.println("" + stocks.size());
		
		MASlope slope = new MASlope(stocks);
		for(int i=0; i< slope.getSlopes().size() ; i++){
			System.out.println("slope = " +slope.getSlopes().get(i).slope + ", count = " +  slope.getSlopes().get(i).count);
			int sum = 0;
			for(int j=0; j< slope.getSlopes().get(i).stocks.size(); j++){
				sum += slope.getSlopes().get(i).stocks.get(j).getClosePrice();
			}
			//if(sum)
		}
	}

}
